package net.sudot.chess.listener.game;

import net.sudot.chess.business.controller.websocket.ChatWebSocketServer;
import net.sudot.chess.event.game.ExitedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 玩家加入游戏事件
 *
 * @author tangjialin on 2018-06-19.
 */
@Component
public class ExitedEventListener implements ApplicationListener<ExitedEvent> {
    @Override
    public void onApplicationEvent(ExitedEvent event) {
        // 发送游戏玩家退出信息
        ChatWebSocketServer.sendMessageAtPlayerExit(event.getRoom().getId());
    }
}
